﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace KinectWindows.Math
{
    public class Vector4
    {
        private int p1;
        private double p2;
        private int p3;
        private int p4;
        public float Left { set; get; }
        public float Top { set; get; }
        public float Right { set; get; }
        public float Buttom { set; get; }
        public Vector2 Center
        {
            get
            {
                return new Vector2((Left - Right) / 2, (Top - Buttom) / 2);
            }
        }

        public Vector4(float left, float top, float right, float buttom)
        {
            Left = left;
            Top = top;
            Right = right;
            Buttom = buttom;
        }

        public Vector4()
        {
            // TODO: Complete member initialization
        }





        public static Vector4 operator +(Vector4 v1, Vector4 v2)
        {
            return new Vector4(v1.Left + v2.Left, v1.Top + v2.Top, v1.Right + v2.Right, v1.Buttom + v2.Buttom);

        }
        public static Vector4 operator -(Vector4 v1, Vector4 v2)
        {
            return new Vector4(v1.Left - v2.Left, v1.Top - v2.Top, v1.Right - v2.Right, v1.Buttom - v2.Buttom);
        }
        public static Vector4 operator *(Vector4 v1, double v2)
        {
            return new Vector4(v1.Left * (float)v2, v1.Top * (float)v2, v1.Right * (float)v2, v1.Right * (float)v2);
        }
        public static Vector4 operator *(Vector4 v1, Vector4 v2)
        {
            return new Vector4(v1.Left * v2.Left, v1.Top * v2.Top, v1.Right * v2.Right, v1.Buttom * v2.Buttom);
        }
        public static Vector4 operator /(Vector4 v1, Vector4 v2)
        {
            return new Vector4(v1.Left / v2.Left, v1.Top / v2.Top, v1.Right / v2.Right, v1.Buttom + v2.Buttom);
        }
        public static Boolean operator &(Vector4 v1, Vector4 v2)
        {
            return (v1.Left == v2.Left) & (v2.Right == v2.Right) & (v1.Top == v2.Top) & (v1.Buttom == v2.Buttom);
        }
        public static Boolean operator |(Vector4 v1, Vector4 v2)
        {
            return (v1.Left == v2.Left) | (v2.Right == v2.Right) | (v1.Top == v2.Top) | (v1.Buttom == v2.Buttom);
        }
        public static Boolean operator ==(Vector4 v1, Vector4 v2)
        {
            return (v1.Left == v2.Left) & (v2.Right == v2.Right) & (v1.Top == v2.Top) & (v1.Buttom == v2.Buttom);
        }
        public static Boolean operator !=(Vector4 v1, Vector4 v2)
        {
            return (v1.Left != v2.Left) & (v2.Right != v2.Right) & (v1.Top != v2.Top) & (v1.Buttom != v2.Buttom);
        }
        public static Vector4 Zero
        {
            get { return new Vector4(0, 0, 0, 0); }
        }
        public static Vector4 One
        {
            get { return new Vector4(1, 1, 1, 1); }
        }
        public Boolean Vector2InBound(Vector2 v)
        {

            return (v.X > Left) & (v.X < Right) & (v.Y > Top) & (v.Y < Buttom);

        }
        public Boolean IsVectorIntersect(Vector4 v)
        {
            return (v.Left < Left) | (v.Right > Right) | (v.Top > Top) | (v.Buttom < Buttom);
        }
        public bool Equals(Vector4 obj)
        {

            return this == obj;
        }
        public Double Distance(Vector2 v)
        {

            return 0;
        }

        internal bool Vector2InBound(System.Windows.Point v)
        {
            return (v.X > Left) & (v.X < Right) & (v.Y > Top) & (v.Y < Buttom);
        }

        internal double Min()
        {
            double m = 100000000000000000;
            m = System.Math.Min(m, Top);
            m = System.Math.Min(m, Left);
            m = System.Math.Min(m, Right);
            m = System.Math.Min(m, Buttom);

            return m;

        }





       

        internal bool TestPoint(Vector2 point)
        {
            throw new NotImplementedException();
        }

        internal bool TestPoint(System.Windows.Point point)
        {
            throw new NotImplementedException();
        }

        public float Width { get { return System.Math.Abs(Left - Right); } }
        public float Height { get { return System.Math.Abs(Top - Buttom); } }
    }
   
}
